package com.ruoyi.web.controller.repair;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.data.DataUtils;
import com.ruoyi.door.domain.HouseDoorT;
import com.ruoyi.door.service.IHouseDoorTService;
import com.ruoyi.project.domain.HouseProjectT;
import com.ruoyi.project.domain.HouseRepairCheckT;
import com.ruoyi.project.service.IHouseProjectTService;
import com.ruoyi.repairGroup.domain.HouseRepairGroupT;
import com.ruoyi.repairGroup.service.IHouseRepairGroupTService;
import com.ruoyi.setup.domain.HouseSetupT;
import com.ruoyi.setup.service.IHouseSetupTService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;

/**
 * 楼宇维修明细表Controller
 *
 * @author ruoyi
 * @date 2023-05-26
 */
@RestController
@RequestMapping("/repair/repairGroup")
public class HouseRepairGroupTController extends BaseController {
    @Autowired
    private IHouseRepairGroupTService houseRepairGroupTService;
    private String projectId;
    @Autowired
    private IHouseProjectTService houseProjectTService;
    @Autowired
    private IHouseDoorTService houseDoorTService;
    @Autowired
    private IHouseSetupTService houseSetupTService;

    public HouseRepairGroupTController(IHouseProjectTService houseProjectTService) {
        this.houseProjectTService = houseProjectTService;
    }

    /**
     * 查询楼宇维修明细表列表
     */
    @GetMapping("/list")
    public TableDataInfo list(HouseRepairGroupT houseRepairGroupT) {
        HouseProjectT projectVO = new HouseProjectT();
        HouseRepairGroupT houseRepairGroupVO = new HouseRepairGroupT();
        List<HouseRepairGroupT> list = new ArrayList<HouseRepairGroupT>();
        projectId = houseRepairGroupT.getProjectId();
        projectVO = houseProjectTService.selectHouseProjectTByProjectId(projectId);
        if (projectVO != null && "1".equals(projectVO.getProjectSts())) {
        } else {
            startPage();
            list = houseRepairGroupTService.selectHouseRepairGroupTList(houseRepairGroupT);
            if (list.size() != 0) {
                if (getDataTableSumJudge(list)) {
                    houseRepairGroupVO = houseRepairGroupTService.selectHouseRepairGroupSum(houseRepairGroupT);
                    houseRepairGroupVO.setAreaName("合计");
                    list.add(houseRepairGroupVO);
                }
            }
        }
        return getDataTable(list);
    }

    /**
     * 导出楼宇维修明细表列表
     */
    @Log(title = "楼宇维修明细表", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, HouseRepairGroupT houseRepairGroupT) {
        HouseRepairGroupT houseRepairGroupVO = new HouseRepairGroupT();
        List<HouseRepairGroupT> list = new ArrayList<HouseRepairGroupT>();
        HouseProjectT projectVO = new HouseProjectT();
        projectId = houseRepairGroupT.getProjectId();
        projectVO = houseProjectTService.selectHouseProjectTByProjectId(projectId);
        if (projectVO != null && "1".equals(projectVO.getProjectSts())) {
        } else {
            list = houseRepairGroupTService.selectHouseRepairGroupTList(houseRepairGroupT);
            if (getDataTableSumJudge(list)) {
                houseRepairGroupVO = houseRepairGroupTService.selectHouseRepairGroupSum(houseRepairGroupT);
                houseRepairGroupVO.setAreaName("合计");
                list.add(houseRepairGroupVO);
            }
        }
        ExcelUtil<HouseRepairGroupT> util = new ExcelUtil<HouseRepairGroupT>(HouseRepairGroupT.class);
        util.exportExcel(response, list, "楼宇维修明细表数据");
    }

    /**
     * 获取楼宇维修明细表详细信息
     */
    @GetMapping(value = "/{houseId}/{projectId}")
    public AjaxResult getInfo(@PathVariable("houseId") String houseId, @PathVariable("projectId") String projectId) {
        HouseRepairGroupT houseRepairGroupVO = new HouseRepairGroupT();
        houseRepairGroupVO.setHouseId(houseId);
        houseRepairGroupVO.setProjectId(projectId);
        return AjaxResult.success(houseRepairGroupTService.getRepairDetail(houseRepairGroupVO));
    }

    /**
     * 新增楼宇维修明细表
     */
    @Log(title = "楼宇维修明细表", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody HouseRepairGroupT houseRepairGroupT) {
        return toAjax(houseRepairGroupTService.insertHouseRepairGroupT(houseRepairGroupT));
    }

    /**
     * 修改楼宇维修明细表
     */
    @Log(title = "楼宇维修明细表", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody HouseRepairGroupT houseRepairGroupT) {
        HouseRepairGroupT houseRepairGroupVO = new HouseRepairGroupT();
        HouseRepairCheckT houseRepairCheckO = new HouseRepairCheckT();
        HouseProjectT houseProjectT = new HouseProjectT();
        houseRepairGroupVO = houseRepairGroupTService.getRepairDetail(houseRepairGroupT);
        Double retained = getRetained();
        houseProjectT.setProjectId(houseRepairGroupT.getProjectId());
        houseProjectT.setRepairMoney(houseRepairGroupVO.getRepairMoney());
        houseProjectT.setCheckMoney(houseRepairGroupT.getRepairMoney());
        HouseSetupT houseSetupT = houseSetupTService.selectHouseSetupTByFeeStandards();
        if("Y".equals(houseSetupT.getBeInDebtSys())){
            if("Y".equals(houseSetupT.getBuckleRateSys())){
                if (houseRepairGroupT.getRepairMoney() == 0) {
                    houseRepairGroupVO.setNoMoney(0d);
                    houseRepairGroupVO.setPayBalance(0d);
                    houseRepairGroupVO.setPayRate(0d);
                } else if (houseRepairGroupVO.getBalance() <= houseRepairGroupVO.getBudgetMoney() * retained) {
                    if (houseRepairGroupVO.getBalanceSum() - houseRepairGroupVO.getBudgetMoney() * retained <= 0) {
                        houseRepairGroupVO.setNoMoney(0d);
                        houseRepairGroupVO.setPayBalance(houseRepairGroupT.getRepairMoney());
                        houseRepairGroupVO.setPayRate(0d);
                    } else if (houseRepairGroupVO.getBalanceSum() - houseRepairGroupVO.getBudgetMoney() * retained >= houseRepairGroupT.getRepairMoney()) {
                        houseRepairGroupVO.setNoMoney(0d);
                        houseRepairGroupVO.setPayBalance(0d);
                        houseRepairGroupVO.setPayRate(houseRepairGroupT.getRepairMoney());
                    } else {
                        houseRepairGroupVO.setNoMoney(0d);
                        houseRepairGroupVO.setPayRate(DataUtils.doubleScale2(houseRepairGroupVO.getBalanceSum() - houseRepairGroupVO.getBudgetMoney() * retained));
                        houseRepairGroupVO.setPayBalance(DataUtils.doubleScale2(houseRepairGroupT.getRepairMoney() - houseRepairGroupVO.getPayRate()));
                    }
                } else if (houseRepairGroupVO.getBalance() - houseRepairGroupT.getRepairMoney() >= houseRepairGroupVO.getBudgetMoney() * retained) {
                    houseRepairGroupVO.setNoMoney(0d);
                    houseRepairGroupVO.setPayBalance(houseRepairGroupT.getRepairMoney());
                    houseRepairGroupVO.setPayRate(0d);
                } else {
                    if (houseRepairGroupVO.getBalanceSum() - houseRepairGroupVO.getBudgetMoney() * retained >= houseRepairGroupT.getRepairMoney()) {
                        houseRepairGroupVO.setNoMoney(0d);
                        houseRepairGroupVO.setPayBalance(DataUtils.doubleScale2(houseRepairGroupVO.getBalance()-houseRepairGroupVO.getBudgetMoney() * retained));
                        houseRepairGroupVO.setPayRate(DataUtils.doubleScale2(houseRepairGroupT.getRepairMoney()-houseRepairGroupVO.getPayBalance()));
                    } else {
                        houseRepairGroupVO.setNoMoney(0d);
                        houseRepairGroupVO.setPayRate(houseRepairGroupVO.getRateMoney());
                        houseRepairGroupVO.setPayBalance(DataUtils.doubleScale2(houseRepairGroupT.getRepairMoney()-houseRepairGroupVO.getPayRate()));

                    }
                }
            }else{
                houseRepairGroupVO.setNoMoney(0d);
                houseRepairGroupVO.setPayBalance(houseRepairGroupT.getRepairMoney());
                houseRepairGroupVO.setPayRate(0d);
            }
        }else{
            if("Y".equals(houseSetupT.getBuckleRateSys())){
                if (houseRepairGroupT.getRepairMoney() == 0) {
                    houseRepairGroupVO.setNoMoney(0d);
                    houseRepairGroupVO.setPayBalance(0d);
                    houseRepairGroupVO.setPayRate(0d);
                } else if (houseRepairGroupVO.getBalance() <= houseRepairGroupVO.getBudgetMoney() * retained) {
                    if (houseRepairGroupVO.getBalanceSum() - houseRepairGroupVO.getBudgetMoney() * retained <= 0) {
                        houseRepairGroupVO.setNoMoney(houseRepairGroupT.getRepairMoney());
                        houseRepairGroupVO.setPayBalance(0d);
                        houseRepairGroupVO.setPayRate(0d);
                    } else if (houseRepairGroupVO.getBalanceSum() - houseRepairGroupVO.getBudgetMoney() * retained >= houseRepairGroupT.getRepairMoney()) {
                        houseRepairGroupVO.setNoMoney(0d);
                        houseRepairGroupVO.setPayBalance(0d);
                        houseRepairGroupVO.setPayRate(houseRepairGroupT.getRepairMoney());
                    } else {
                        houseRepairGroupVO.setNoMoney(DataUtils.doubleScale2(houseRepairGroupT.getRepairMoney() - (houseRepairGroupVO.getBalanceSum() - houseRepairGroupVO.getBudgetMoney() * retained)));
                        houseRepairGroupVO.setPayBalance(0d);
                        houseRepairGroupVO.setPayRate(DataUtils.doubleScale2(houseRepairGroupVO.getBalanceSum() - houseRepairGroupVO.getBudgetMoney() * retained));
                    }
                } else if (houseRepairGroupVO.getBalance() - houseRepairGroupT.getRepairMoney() >= houseRepairGroupVO.getBudgetMoney() * retained) {
                    houseRepairGroupVO.setNoMoney(0d);
                    houseRepairGroupVO.setPayBalance(houseRepairGroupT.getRepairMoney());
                    houseRepairGroupVO.setPayRate(0d);
                } else {
                    if (houseRepairGroupVO.getBalanceSum() - houseRepairGroupVO.getBudgetMoney() * retained >= houseRepairGroupT.getRepairMoney()) {
                        houseRepairGroupVO.setNoMoney(0d);
                        houseRepairGroupVO.setPayBalance(DataUtils.doubleScale2(houseRepairGroupVO.getBalance()-houseRepairGroupVO.getBudgetMoney() * retained));
                        houseRepairGroupVO.setPayRate(DataUtils.doubleScale2(houseRepairGroupT.getRepairMoney()-houseRepairGroupVO.getPayBalance()));
                    } else {
                        houseRepairGroupVO.setNoMoney(DataUtils.doubleScale2(houseRepairGroupT.getRepairMoney() - (houseRepairGroupVO.getBalanceSum() - houseRepairGroupVO.getBudgetMoney() * retained)));
                        houseRepairGroupVO.setPayBalance(DataUtils.doubleScale2(houseRepairGroupVO.getBalance()-houseRepairGroupVO.getBudgetMoney() * retained));
                        houseRepairGroupVO.setPayRate(DataUtils.doubleScale2(houseRepairGroupT.getRepairMoney()-houseRepairGroupVO.getPayBalance()));
                    }
                }
            }else{

                if (houseRepairGroupT.getRepairMoney() == 0) {
                    houseRepairGroupVO.setNoMoney(0d);
                    houseRepairGroupVO.setPayBalance(0d);
                    houseRepairGroupVO.setPayRate(0d);
                } else if (houseRepairGroupVO.getBalance() <= houseRepairGroupVO.getBudgetMoney() * retained) {
                    houseRepairGroupVO.setNoMoney(houseRepairGroupT.getRepairMoney());
                    houseRepairGroupVO.setPayBalance(0d);
                    houseRepairGroupVO.setPayRate(0d);
                } else if (houseRepairGroupVO.getBalance() - houseRepairGroupT.getRepairMoney() >= houseRepairGroupVO.getBudgetMoney() * retained) {
                    houseRepairGroupVO.setNoMoney(0d);
                    houseRepairGroupVO.setPayBalance(houseRepairGroupT.getRepairMoney());
                    houseRepairGroupVO.setPayRate(0d);
                } else {
                    houseRepairGroupVO.setNoMoney(DataUtils.doubleScale2(houseRepairGroupT.getRepairMoney() - (houseRepairGroupVO.getBalance() - houseRepairGroupVO.getBudgetMoney() * retained)));
                    houseRepairGroupVO.setPayBalance(DataUtils.doubleScale2(houseRepairGroupVO.getBalance() - houseRepairGroupVO.getBudgetMoney() * retained));
                    houseRepairGroupVO.setPayRate(0d);
                }

            }
        }

        houseRepairGroupVO.setPayMoney(houseRepairGroupT.getRepairMoney() - houseRepairGroupVO.getNoMoney());
        Double balance1 = DataUtils.subMoney(houseRepairGroupVO.getBalanceSum(), houseRepairGroupVO.getPayMoney());
        if (balance1 == 0) {
            houseRepairGroupVO.setBalanceRatio(0d);
            houseRepairGroupVO.setRepairRatio(0d);
        } else {
            Double balanceRatio = DataUtils.divideMoney(balance1, houseRepairGroupVO.getBudgetMoney()) * 100;
            houseRepairGroupVO.setBalanceRatio(balanceRatio);
            Double repairRatio = DataUtils.divideMoney(houseRepairGroupT.getRepairMoney(), houseRepairGroupVO.getBudgetMoney()) * 100;
            houseRepairGroupVO.setRepairRatio(repairRatio);
        }
        houseRepairCheckO.setHouseId(houseRepairGroupVO.getHouseId());
        houseRepairCheckO.setProjectId(houseRepairGroupVO.getProjectId());
        houseRepairCheckO.setRepairMoney(houseRepairGroupVO.getRepairMoney());
        houseRepairCheckO.setUpdateMoney(houseRepairGroupT.getRepairMoney());
        houseRepairGroupVO.setRepairMoney(houseRepairGroupT.getRepairMoney());
        houseRepairCheckO.setUpdater(getUsername());
        return toAjax(houseRepairGroupTService.updateHouseRepairGroupT(houseRepairGroupVO, houseRepairCheckO, houseProjectT));
    }

    @GetMapping(value = "/getCalculate")
    public AjaxResult getCalculateByProjectId(HouseProjectT houseProjectT) {
        HouseProjectT houseProjectVO = new HouseProjectT();
        HouseDoorT doorVO = new HouseDoorT();
        HouseRepairGroupT houseRepairGroupVO = new HouseRepairGroupT();
        Double trueMoney = 0d;
        String projectId = houseProjectT.getProjectId();
        Double price = houseProjectT.getPrice();
        houseProjectVO = houseProjectTService.selectHouseProjectTByProjectId(projectId);
        houseRepairGroupVO.setProjectId(projectId);
        List<HouseRepairGroupT> houseRepairGroupList = houseRepairGroupTService.selectHouseRepairGroupTList(houseRepairGroupVO);
        doorVO.setAreaName(houseProjectVO.getAreaName());
        doorVO.setGroupName(houseProjectVO.getGroupName());
        doorVO = houseDoorTService.getBalanceMoneyAll(doorVO);
        if (price == null) {
            price = DataUtils.divideMoney(houseProjectVO.getProjectMoney(), doorVO.getSpace());
        }
//        BigDecimal price =(BigDecimal.valueOf(houseProjectVO.getProjectMoney())).divide(BigDecimal.valueOf(doorVO.getSpace()),6,BigDecimal.ROUND_HALF_UP);
        for (HouseRepairGroupT vo : houseRepairGroupList) {
            if (vo.getSpace() == 0) {
                String houseid = vo.getHouseId();
                return AjaxResult.error(houseid + "该房屋编号面积为0,不能产生分摊");
            }
            Double repairMoney = DataUtils.spaceMoney(vo.getSpace(), price);
            trueMoney = DataUtils.sumMoney(trueMoney, repairMoney);
        }
        houseProjectVO.setTrueMoney(trueMoney);
        houseProjectVO.setPrice(price);
        houseProjectVO.setSpace(doorVO.getSpace());
        return AjaxResult.success(houseProjectVO);
    }

    /**
     * 核算
     */
    @Log(title = "核算", businessType = BusinessType.UPDATE)
    @PutMapping("/updateCalculate")
    public AjaxResult updateCalculate(@RequestBody HouseProjectT houseProjectT) {
        List<HouseRepairGroupT> repairListTemp = new ArrayList<HouseRepairGroupT>();
        HouseProjectT projectVO = new HouseProjectT();
        HouseRepairGroupT houseRepairGroupVO = new HouseRepairGroupT();
        houseRepairGroupVO.setProjectId(houseProjectT.getProjectId());
        Double price = Double.valueOf(houseProjectT.getPrice());
        Double trueMoney = 0d;
        Double retained = getRetained();
        List<HouseRepairGroupT> houseRepairGroupList = houseRepairGroupTService.selectHouseRepairGroupTList(houseRepairGroupVO);
        HouseSetupT houseSetupT = houseSetupTService.selectHouseSetupTByFeeStandards();
        for (HouseRepairGroupT vo : houseRepairGroupList) {
            HouseRepairGroupT temp = new HouseRepairGroupT();
            Double repaireMoney = 0d;
            repaireMoney = DataUtils.doubleScale2(vo.getSpace() * price);
            if("Y".equals(houseSetupT.getBeInDebtSys())){
                if("Y".equals(houseSetupT.getBuckleRateSys())){
                    if (repaireMoney == 0) {
                        temp.setNoMoney(0d);
                        temp.setPayBalance(0d);
                        temp.setPayRate(0d);
                    } else if (vo.getBalance() <= vo.getBudgetMoney() * retained) {
                        if (vo.getBalanceSum() - vo.getBudgetMoney() * retained <= 0) {
                            temp.setNoMoney(0d);
                            temp.setPayBalance(repaireMoney);
                            temp.setPayRate(0d);
                        } else if (vo.getBalanceSum() - vo.getBudgetMoney() * retained >= repaireMoney) {
                            temp.setNoMoney(0d);
                            temp.setPayBalance(0d);
                            temp.setPayRate(repaireMoney);
                        } else {
                            temp.setNoMoney(0d);
                            temp.setPayRate(DataUtils.doubleScale2(vo.getBalanceSum() - vo.getBudgetMoney() * retained));
                            temp.setPayBalance(DataUtils.doubleScale2(repaireMoney - temp.getPayRate()));
                        }
                    } else if (vo.getBalance() - repaireMoney >= vo.getBudgetMoney() * retained) {
                        temp.setNoMoney(0d);
                        temp.setPayBalance(repaireMoney);
                        temp.setPayRate(0d);
                    } else {
                        if (vo.getBalanceSum() - vo.getBudgetMoney() * retained >= repaireMoney) {
                            temp.setNoMoney(0d);
                            temp.setPayBalance(DataUtils.doubleScale2(vo.getBalance()-vo.getBudgetMoney() * retained));
                            temp.setPayRate(DataUtils.doubleScale2(repaireMoney-temp.getPayBalance()));
                        } else {
                            temp.setNoMoney(0d);
                            temp.setPayRate(vo.getRateMoney());
                            temp.setPayBalance(DataUtils.doubleScale2(repaireMoney-temp.getPayRate()));
                        }
                    }
                }else{
                    temp.setNoMoney(0d);
                    temp.setPayBalance(repaireMoney);
                    temp.setPayRate(0d);
                }
            }else{
                if("Y".equals(houseSetupT.getBuckleRateSys())){
                    if (repaireMoney == 0) {
                        temp.setNoMoney(0d);
                        temp.setPayBalance(0d);
                        temp.setPayRate(0d);
                    } else if (vo.getBalance() <= vo.getBudgetMoney() * retained) {
                        if (vo.getBalanceSum() - vo.getBudgetMoney() * retained <= 0) {
                            temp.setNoMoney(repaireMoney);
                            temp.setPayBalance(0d);
                            temp.setPayRate(0d);
                        } else if (vo.getBalanceSum() - vo.getBudgetMoney() * retained >= repaireMoney) {
                            temp.setNoMoney(0d);
                            temp.setPayBalance(0d);
                            temp.setPayRate(repaireMoney);
                        } else {
                            temp.setNoMoney(DataUtils.doubleScale2(repaireMoney - (vo.getBalanceSum() - vo.getBudgetMoney() * retained)));
                            temp.setPayBalance(0d);
                            temp.setPayRate(DataUtils.doubleScale2(vo.getBalanceSum() - vo.getBudgetMoney() * retained));
                        }
                    } else if (vo.getBalance() - repaireMoney >= vo.getBudgetMoney() * retained) {
                        temp.setNoMoney(0d);
                        temp.setPayBalance(repaireMoney);
                        temp.setPayRate(0d);
                    } else {
                        if (vo.getBalanceSum() - vo.getBudgetMoney() * retained >= repaireMoney) {
                            temp.setNoMoney(0d);
                            temp.setPayBalance(DataUtils.doubleScale2(vo.getBalance()-vo.getBudgetMoney() * retained));
                            temp.setPayRate(DataUtils.doubleScale2(repaireMoney-temp.getPayBalance()));
                        } else {
                            temp.setNoMoney(DataUtils.doubleScale2(repaireMoney - (vo.getBalanceSum() - vo.getBudgetMoney() * retained)));
                            temp.setPayBalance(DataUtils.doubleScale2(vo.getBalance()-vo.getBudgetMoney() * retained));
                            temp.setPayRate(DataUtils.doubleScale2(repaireMoney-temp.getNoMoney()-temp.getPayBalance()));
                        }
                    }
                }else{

                    if (repaireMoney == 0) {
                        temp.setNoMoney(0d);
                        temp.setPayBalance(0d);
                        temp.setPayRate(0d);
                    } else if (vo.getBalance() <= vo.getBudgetMoney() * retained) {
                        temp.setNoMoney(repaireMoney);
                        temp.setPayBalance(0d);
                        temp.setPayRate(0d);
                    } else if (vo.getBalance() - repaireMoney >= vo.getBudgetMoney() * retained) {
                        temp.setNoMoney(0d);
                        temp.setPayBalance(repaireMoney);
                        temp.setPayRate(0d);
                    } else {
                        temp.setNoMoney(DataUtils.doubleScale2(repaireMoney - (vo.getBalance() - vo.getBudgetMoney() * retained)));
                        temp.setPayBalance(DataUtils.doubleScale2(vo.getBalance() - vo.getBudgetMoney() * retained));
                        temp.setPayRate(0d);
                    }

                }
            }

            temp.setProjectId(houseRepairGroupVO.getProjectId());
            temp.setHouseId(vo.getHouseId());
            temp.setRepairMoney(repaireMoney);
            temp.setPayMoney(repaireMoney - temp.getNoMoney());
            temp.setBalance(vo.getBalance());
            //当前余额➗应缴金额*100等于余额比率
            Double balance1 = DataUtils.subMoney(vo.getBalanceSum(), temp.getPayMoney());
            if (balance1 == 0) {
                temp.setBalanceRatio(0d);
                temp.setRepairRatio(0d);
            } else {
                Double balanceRatio = DataUtils.divideMoney(balance1, vo.getBudgetMoney()) * 100;
                temp.setBalanceRatio(balanceRatio);
                Double repairRatio = DataUtils.divideMoney(repaireMoney, vo.getBudgetMoney()) * 100;
                temp.setRepairRatio(repairRatio);
            }
            trueMoney = DataUtils.sumMoney(trueMoney, repaireMoney);
            repairListTemp.add(temp);
        }
        projectVO.setTrueMoney(Double.valueOf(trueMoney.toString()));
        projectVO.setPayMoney(Double.valueOf(trueMoney.toString()));
        projectVO.setProjectId(houseRepairGroupVO.getProjectId());
        houseRepairGroupTService.updateProjectAndRepair(projectVO, repairListTemp);

        return toAjax(1);
    }

    public Double getRetained() {
        HouseSetupT houseSetupT = new HouseSetupT();
        HouseSetupT list = houseSetupTService.selectHouseSetupTByFeeStandards();
        return list.getRetained();
    }

}
